import request from '../../utils/Request'
import PageUtils from '../../utils/PageUtils'

export const listMenuTree = bId => {
    if (bId === undefined || bId === null) {
        bId = 0
    }
    return request({
        method: 'get',
        url: '/api/platform/menu/list/tree/' + bId,
        params: {}
    })
}

/*查询当前用户系统列表*/
export const listSystemByUser = bId => {
    return request({
        method: 'get',
        url: '/api/platform/menu/list/system/user/' + bId,
        params: {}
    })
}

/*查询当前用户绑定菜单*/
export const listUserMenuTreeBySystem = bId => {
    return request({
        method: 'get',
        url: '/api/platform/menu/list/tree/system/' + bId,
        params: {}
    })
}

export const listMenu = data => {
    return request({
        method: 'get',
        url: '/api/platform/menu/list',
        params: data
    })
}

export const listMenuByRoleId = roleId => {
    return request({
        method: 'get',
        url: '/api/platform/menu/list/role/' + roleId,
        params: {}
    })
}

export const saveMenu = data => {
    return request({
        method: 'post',
        url: '/api/platform/menu/save',
        data: data
    })
}

export const createMenu = data => {
    return request({
        method: 'post',
        url: '/api/platform/menu/create',
        data: data
    })
}

export const updateMenu = data => {
    return request({
        method: 'post',
        url: '/api/platform/menu/update',
        data: data
    })
}

export const deleteMenu = bId => {
    return request({
        method: 'get',
        url: '/api/platform/menu/delete/' + bId,
        params: {}
    })
}

export const listMenuByUser = bId => {
    return request({
        method: 'get',
        url: '/api/platform/menu/list/user/' + bId,
        params: {}
    })
}
